package com.twu.biblioteca.menu;

import com.twu.biblioteca.Librarian;

import java.util.HashMap;
import java.util.Map;

public class ReturnMenu implements Menu {
    private Librarian librarian;
    private static Map<String, String> optionMap = new HashMap<String, String>();

    static {
        optionMap.put("1","Books");
        optionMap.put("2","Movies");
        optionMap.put("3","go back");
    }

    public ReturnMenu(Librarian librarian) {
        this.showMenu();
        this.librarian = librarian;
    }

    @Override
    public void showMenu() {
        System.out.println("Ok.You want to return...?");
        System.out.println("->1.Books");
        System.out.println("->2.Movies");
        System.out.println("->3.Go Back");
        System.out.println("Please choose an option(enter an index):");
    }

    @Override
    public Menu processInput(String input) {
        if (input.equals("3")) {
            return new LibraryMenu(librarian);
        }
        else if (input.equals("1")) {
            return new ReturnInfoMenu("Book",librarian);
        }
        else if (input.equals("2")) {
            return new ReturnInfoMenu("Movie",librarian);
        }
        return this;
    }
}
